home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ROBOTS3.ZIP / robots / console.c next >
Encoding:
C/C++ Source or Header  |  1992-04-12  |  1008 b   |  42 lines

  1. #include <stdarg.h>
  2. #include <graph.h>
  3. #include <bios.h>
  4. #include <dos.h>
  5. #include <stdio.h>
  6.  
  7. void Box(int N, int S, int W, int E, int Hue) {
  8.    _setcolor(Hue); _rectangle(_GFILLINTERIOR, W, N, E, S);
  9. }
  10.  
  11. void Border(int N, int S, int W, int E, int Hue) {
  12.    _setcolor(Hue); _rectangle(_GBORDER, W, N, E, S);
  13. }
  14.  
  15. void PutString(int N, int W, int Hue, const char *Format, ...) {
  16.    static char Buf[80];
  17.    va_list AP;
  18.    va_start(AP, Format);
  19.    _settextcolor(Hue); _settextposition(N + 1, W + 1);
  20.    vsprintf(Buf, Format, AP); _outtext(Buf);
  21.    va_end(AP);
  22. }
  23.  
  24. void ScrInit(void) {
  25.    _clearscreen(_GCLEARSCREEN);
  26.    if (_setvideomode(_VRES16COLOR) != 30)
  27.       printf("30 line graphic mode not available on this machine.\n"), exit(1);
  28. }
  29.  
  30. void ScrReset(void) {
  31.    _setvideomode(_DEFAULTMODE); _clearscreen(_GCLEARSCREEN);
  32. }
  33.  
  34. int KeyHit(void) {
  35.    return _bios_keybrd(_KEYBRD_READY);
  36. }
  37.  
  38. int Keyboard(void) {
  39.    int Ch = _bios_keybrd(_KEYBRD_READ);
  40.    return (Ch&0xff) == '\0'? 0x100 | (Ch >> 8)&0xff: Ch&0xff;
  41. }
  42.